package shop.controller;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import shop.dao.IShopcartDao;
import shop.model.Shopcart;
import shop.service.IShopcartService;

@RestController
@RequestMapping("shopcart")
public class ShopcartController {
	
	@Resource
	private IShopcartDao dao;

	@Resource
	private IShopcartService service;
	
	@RequestMapping("add.do")
	public int add(Shopcart cart) {
		return service.add(cart);
	}
	
	@RequestMapping("findCartByUId.do")
	public Map findCartByUId(Integer uid){
		Map map = new HashMap();
		map.put("status",0);
		map.put("infoList", dao.findCartByUId(uid));
		return map;
	}
}
